﻿/*-------------------------------------------------------------------------
* 命名空间: NavigateJournalSimple.ViewModels/ViewBModel
* 类       名: ViewBModel
* 功      能:  TD
* 时      间:  2023/12/22 9:58:23
* 版      本:  V1.0
* 作      者:  Fioman
* 格      言:  Talk is cheap,show me the code ^_^
*-------------------------------------------------------------------------*/
using Prism.Mvvm;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NavigateJournalSimple.ViewModels
{
    public class ViewBModel : BindableBase, INavigationAware
    {
        private string? parameterVal;

        public string? ParameterVal
        {
            get { return parameterVal; }
            set
            {
                parameterVal = value;
                RaisePropertyChanged();
            }
        }


        public bool IsNavigationTarget(NavigationContext navigationContext)
        {
            return true;
        }

        public void OnNavigatedFrom(NavigationContext navigationContext)
        {

        }

        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            var parameterRecv = navigationContext.Parameters;
            if (parameterRecv != null)
            {
                parameterRecv.TryGetValue("Content", out object val);
                if (val != null)
                {
                    ParameterVal = val.ToString();
                }
            }
        }
    }
}
